

#ifndef __JTAG_H__
#define __JTAG_H__

extern void jtag_pin_init(void);
extern void jtag_tap_reset(void);
extern void jtag_tap_idle(int _tick);
extern void jtag_tap_init(void);
extern void jtag_irlen_tapnum(void);
extern void jtag_tap_shift_ir(uint32_t *oldval, uint32_t *newval, int len);
extern void jtag_tap_shift_dr(uint32_t *oldval, uint32_t *newval, int len);

extern uint32_t irlen;
extern uint32_t tapnum;
extern uint32_t idcode;

#define var_bits(x) (sizeof(x) * 8)

#define RISCV_DEBUG_LOG_DBG(...)    printf(__VA_ARGS__)
#define RISCV_DEBUG_LOG_ERR()       do {printf("%s:%d \n", __FILE__, __LINE__);} while (0);
#define RISCV_DEBUG_LOG_ERR2(x)     do {printf("%s:%d rst(%d) \n", __FILE__, __LINE__, (x));} while (0);

#endif
